package com.ytjj.qmyx.data.model.mongo;

import com.ytjj.common.dto.mqdto.SkipStatisticsDto;
import com.ytjj.qmyx.data.util.CalendarUtil;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

/**
 * mongodb skip统计实体
 *
 *
 *  *
 **/
@Document(collection="skip_statistics")
@Data
public class SkipStatistics {

    @Id
    private String _id;

    /**
     * 渠道channel
     */
    private String channel;

    /**
     * sessionId
     */
    private String sessionid;

    /**
     * 点击时间
     */
    private Date createTime;

    /**
     * 域名
     */
    private String uri;

    /**
     * 日期 2014-11-10
     */
    private String dayTime;

    /**
     * 小时时间  0  1  2  13  23
     */
    private Integer hourTime;


    public void copyProperty(SkipStatisticsDto skipStatisticsDto) {
        this.setSessionid(skipStatisticsDto.getSessionid());
        this.setUri(skipStatisticsDto.getUri());
        this.setChannel(skipStatisticsDto.getChannel());
        this.setCreateTime(skipStatisticsDto.getCreateTime());
        this.dayTime = CalendarUtil.dateFormat(skipStatisticsDto.getCreateTime());
        this.hourTime = Integer.parseInt(CalendarUtil.dateFormatHour(skipStatisticsDto.getCreateTime()));
    }

}
